<?php

	$mailTo = 'me@radekkolar.cz';
	$mailFrom = 'me@radekkolar.cz';
	$subject = 'Kontaktni formular - radekkolar.cz';
	$headers = 'Content-type: text/html; charset=utf-8' . "\nFrom: " . $mailFrom;
	$goAfter = 'http://radekkolar.cz/kontakt.html';
	

	$fields = array(
		'name'=> 'Jméno:',
		'surname'=>'Příjmení:',
		'email'=>'Email:',
		'message'=>'Zpráva:'
	);
		
	ob_start();
?>
<html>
	<head>
		<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
	</head>
	<body>
		<table>
<?	
	foreach($fields as $inputName=>$label) {
		?>
			<tr>
				<td><strong><?=htmlspecialchars($label);?></strong></td>
				<td><?=htmlspecialchars($_REQUEST[$inputName]);?></td>
			</tr>
		<?
	}
?>		
		</table>
	</body>
</html>

<?
	$mailBody = ob_get_contents();
	ob_end_clean();
	mail($mailTo, $subject, $mailBody, $headers);
	Header('Location: ' . $goAfter);
	die();